IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spOrdersInsert')
	BEGIN
		DROP  PROCEDURE  spOrdersInsert
	END
GO
-- =============================================
-- Author:		<NamTP>
-- Create date: <Apr 24, 2012>
-- Description:	<Get Company List Infomation>
-- TEST: EXEC spOrdersInsert 17,2,''
-- =============================================
CREATE PROCEDURE spOrdersInsert	
	   @CustomerID NCHAR(5)
      ,@EmployeeID NCHAR(5)      
      ,@ShipVia INT
      ,@Freight MONEY
      ,@ShipName NVARCHAR(40)
      ,@ShipAddress NVARCHAR(60)
      ,@ShipCity NVARCHAR(15)
      ,@ShipRegion NVARCHAR(15)
      ,@ShipPostalCode NVARCHAR(10)
      ,@ShipCountry NVARCHAR(15)
      ,@RequiredDate DATETIME
AS
BEGIN
	INSERT INTO ORDERS(
		CustomerID
      ,[EmployeeID]
      ,[OrderDate]
      ,[RequiredDate]
      ,[ShippedDate]
      ,[ShipVia]
      ,[Freight]
      ,[ShipName]
      ,[ShipAddress]
      ,[ShipCity]
      ,[ShipRegion]
      ,[ShipPostalCode]
      ,[ShipCountry])
      VALUES(
	   @CustomerID
      ,@EmployeeID
      ,GETDATE()
      ,@RequiredDate
      ,GETDATE()
      ,@ShipVia
      ,@Freight
      ,@ShipName
      ,@ShipAddress
      ,@ShipCity
      ,@ShipRegion
      ,@ShipPostalCode
      ,@ShipCountry
      )
      DECLARE @OrderId INT
      SET @OrderId = SCOPE_IDENTITY()
      SELECT @OrderId
END
GO
